package com.yupi.springbootinit.judge.codesanbox.model.impl;

import com.yupi.springbootinit.judge.codesanbox.CodeSanBox;
import com.yupi.springbootinit.judge.codesanbox.model.ExecuteCondeRequest;
import com.yupi.springbootinit.judge.codesanbox.model.ExecuteCondeResponse;
import com.yupi.springbootinit.judge.codesanbox.model.JudgeInfo;
import com.yupi.springbootinit.model.enums.JudgeInfoMessageEnum;
import com.yupi.springbootinit.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * 实例代码沙箱（仅为了跑通业务流程）
 */
public class ExampleCodeSanBox implements CodeSanBox {
    @Override
    public ExecuteCondeResponse executeCode(ExecuteCondeRequest executeCondeRequest) {
        List<String> inputList = executeCondeRequest.getInputList();

        ExecuteCondeResponse executeCondeResponse = new ExecuteCondeResponse();

        executeCondeResponse.setOutputList(inputList);
        executeCondeResponse.setMessage("测试执行成功");
        executeCondeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());

        JudgeInfo judgeInfo = new JudgeInfo();

        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
        judgeInfo.setMemory(1000L);
        judgeInfo.setTime(1000L);

        executeCondeResponse.setJudgeInfo(judgeInfo);

        return executeCondeResponse;
    }
}
